package com.mspbots.attendance.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mspbots.attendance.controller.AttendanceController;
import com.mspbots.attendance.enums.AttendanceTypeEnum;
import com.mspbots.attendance.model.Attendance;
import com.mspbots.entry.SenderMessageBody;
import com.mspbots.entry.UserMappingResponse;

import java.util.List;

/**
 * @author billb
 */
public interface AttendanceService extends IService<Attendance> {
    /**
     * <p></h1>find by user log last one
     * <p>is by LogTime desc, limit 1
     *
     * @param lastParams query params by
     * @return user log model
     */
    Attendance findLogLast(AttendanceController.AttendanceParams lastParams);

    /**
     * shard select query model list
     *
     * @param lastParams query params by
     * @return model list entity.
     */
    List<Attendance> selectList(AttendanceController.AttendanceParams lastParams);

    /**
     * get this day all user time log entity.
     *
     * @param lastParams query params by
     * @return tenant all user time log or user null time log,every day
     */
    List<Attendance> allUserDay(AttendanceController.AttendanceParams lastParams);

    /**
     * Handle the business logic for attendance according to different types
     *
     * @param type    different types
     * @param mapping Relational mapping of users
     * @return Returns the attendance entity class
     */
    Attendance attendance(UserMappingResponse mapping, AttendanceTypeEnum type);

    /**
     * Handle the business logic for attendance according to different types
     *
     * @param type    different types
     * @param mapping Relational mapping of users
     * @param body    custom SenderMessageBody  set
     * @return Returns the attendance entity class
     */
    Attendance attendance(UserMappingResponse mapping, AttendanceTypeEnum type, SenderMessageBody body);

    /**
     * If there is  the business logic for attendance according to different types
     *
     * @param mapping Relational mapping of users
     * @return Returns the attendance entity class
     */
    Attendance attendanceExists(UserMappingResponse mapping);

    /**
     * If there is  the business logic for attendance find by page
     *
     * @param page       page model
     * @param lastParams query params
     * @return get model page
     */
    IPage<Attendance> page(IPage<Attendance> page, AttendanceController.AttendanceParams lastParams);

    /**
     * save attendance entry
     *
     * @param lastParams dto params
     * @return get model attendance
     */
    Attendance save(AttendanceController.AttendanceParams lastParams);
}
